//
//  SurveyModel.swift
//  LongTermInsurance
//
//  Created by DYD on 2018/11/22.
//  Copyright © 2018 HeChao. All rights reserved.
//

import UIKit
import ObjectMapper

@objcMembers class SurveyItem: NSObject,Mappable {
    
    var titleNO: Float = 0.0
    var itemNO: Float = 0.0
    var itemName = ""
    
    // {"NAME":"姓名","Sex":"性别","UserId":"身份证","PersonNum":"个人编号","PerCardNum":"社保卡号"}
    
    required init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        titleNO <- map["TITLENO"]
        itemNO <- map["KEYNO"]
        itemName <- map["KEYNAME"]
        if itemName.count == 0 {
            titleNO <- map["TitleNo"]
            itemNO <- map["KeyNo"]
            itemName <- map["KeyName"]
        }
    }
}

@objcMembers class SurveyModel: NSObject,Mappable {
    
    var surveyArray = [SurveyItem]()
    var title = ""
    var titleNO: Float = 0.0
    var selectIndex = 0
    // {"NAME":"姓名","Sex":"性别","UserId":"身份证","PersonNum":"个人编号","PerCardNum":"社保卡号"}
    
    required init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        titleNO <- map["TITILENO"]
        title <- map["TITLE"]
        if title.count == 0 {
            titleNO <- map["TitileNo"]
            title <- map["Title"]
        }
    }
}


class ZoneModel: NSObject, Mappable, PickerProtocol {
    
    var zoneNum = ""
    var zoneName = ""
    var remark = ""
    var showName: String {
        return zoneName
    }
    required init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        zoneNum <- map["ZoningNum"]
        zoneName <- map["ZoningName"]
        remark <- map["Remarks"]
        if zoneNum.count == 0 {
            zoneNum <- map["ZoningNum".uppercased()]
            zoneName <- map["ZoningName".uppercased()]
            remark <- map["Remarks".uppercased()]
        }
    }
}
//ZoningNum":"10","ZoningName":"测试区","Remarks":"测试区222"

class StreetModel: NSObject, Mappable, PickerProtocol {
    
    var streetNum = ""
    var streetName = ""
    var showName: String {
        return streetName
    }
    required init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        streetNum <- map["StreetNum"]
        streetName <- map["StreetName"]
        if streetNum.count == 0 {
            streetNum <- map["StreetNum".uppercased()]
            streetName <- map["StreetName".uppercased()]
        }
    }
}

